-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(gateway): IPNS record response format (IPIP-351) #9399
Conversation
df28c43
to
fc8c9a2
Compare
@lidel while thinking about caching of the IPNS records, I found this: ipfs/boxo#329. Now I see the following options going forward:
|
6ab98aa
to
990586f
Compare
PSA: I added a small CLI command |
ac924b8
to
dde132a
Compare
@hacdias This sounds like the best course of action. Please add it to Resolver interface. Light clients will resolve IPNS via gateway, and that means implicit assumption the HTTP response respects the TTL set in the signed IPNS record. Reverse proxies will cache responses, so this TTL needs to be translated to HTTP Cache control headers – without this we will have flaky behavior and bad UX/DX. If we can also fix cache-control headers for regular ps. Unsure what you mean by "Resolve does + TTL + IPNS Key" – the key is either included in IPNS record (RSA) or inlined in the libp2p-key CID (ED25519), no need for additional lookup. |
What I meant is that: |
Note to self: tests failing in
|
|
@lidel started working on adding the TTL to the Namesys package (ipfs/go-namesys#34). However, updating it on Kubo its being slightly harder than I expected, as we don't directly call namesys.Resolve in the HTTP handler. So I probably have to add another set of functions in Kubo in order to bubble up the TTL to the gateway. I'm not sure if doing that in this PR is a great idea as I wanted to make the scope the smallest as possible. What we can do in this PR is:
And then solve the IPNS TTL issue in a separate PR to avoid making this PR too large and unscoped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) sounds like a safer path 👍
1bdb9f5
to
6387e03
Compare
6387e03
to
5544107
Compare
Implementation ready for review with proper cache control. Note that this PR needs #9471 to be merged first. |
5544107
to
6944b58
Compare
e32eb1b
to
96414b9
Compare
915d244
to
d3a9402
Compare
96414b9
to
03db314
Compare
d3a9402
to
b76faa6
Compare
0df0d8f
to
63fd9b2
Compare
63fd9b2
to
982ff1e
Compare
2c35c3e
to
ffc992d
Compare
b2ed5ae
to
a38adc6
Compare
ffc992d
to
fa6adfc
Compare
8b48923
to
1e4c6a0
Compare
fa6adfc
to
aaafc4c
Compare
aaafc4c
to
2c319a3
Compare
We made changes to get/put, and there were no tests for them, so assuming they are rarely used these days. Let's mark them as Experimental to lower the expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, IPIP-351 things look good 👍
I've rebased.
This PR changes the wire format of some rarely used low level commands (details below),
but since all regression tests for put
and get
pass I assume they are useful mostly on the CLI, and the JSON response change does not break anyone (otherwise, there would be a regression test).
I agree with your decision to switch to CoreAPI and avoid having duplicated code.
Just to be safe, I've marked them as experimental and removed unused -v
parameter.
We are missing tracing span, but that can be added after we are in go-libipfs.
Since we want to unblock gateway extraction, I'm merging this as-is.
}), | ||
}, | ||
Type: routing.QueryEvent{}, | ||
Type: []byte{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 This changes both /api/v0/dht/get
and /api/v0/routing/get
(https://docs.ipfs.tech/reference/kubo/rpc/):
-{
- "Extra": "<string>",
- "ID": "<peer-id>",
- "Responses": [
- {
- "Addrs": [
- "<multiaddr-string>"
- ],
- "ID": "peer-id"
- }
- ],
- "Type": "<int>"
-}
+"<base64-string>"
and breaks --verbose
flag in both.
I've removed flag and marked routing/get
as Experimental (dht/get
was already deprecated)
}), | ||
}, | ||
Type: routing.QueryEvent{}, | ||
Type: []byte{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 This changes both /api/v0/dht/put
and /api/v0/routing/put
(https://docs.ipfs.tech/reference/kubo/rpc/):
-{
- "Extra": "<string>",
- "ID": "<peer-id>",
- "Responses": [
- {
- "Addrs": [
- "<multiaddr-string>"
- ],
- "ID": "peer-id"
- }
- ],
- "Type": "<int>"
-}
+"<base64-string>"
and breaks --verbose
flag in both.
I've removed flag and marked routing/put
as Experimental (dht/put
was already deprecated)
@lidel Just to ask, is this feature set to arrive for Kubo v0.19 or something like v0.18.1? Not sure what the timeline for this feature is |
all IPNS improvements will land in 0.19 (we want to go over proper Release Candidate first) |
What
Implementation of IPIP-351: IPNS Signed Records Response Format on HTTP Gateways (ipfs/specs#351)
Checklist
/ipns
namespace is tracked on Gateway: Cache-Control, max-age=ttl, ETag for /ipns requests boxo#329. I can possibly take over afterwards.Important Notes
put round trips (#3124)
was failing. I understand that it expected some output, but the test doesn't validate the output so it's not clear to me what it was. When refactoring theRouting
API to theCoreAPI
interface, I used the direct calls to the internal routing value store to get or put a value, instead of listening to events on the context field.BREAKING RPC CHANGE
This changes output of selected RPC commands (https://docs.ipfs.tech/reference/kubo/rpc/):
/api/v0/dht/get
and/api/v0/routing/get
/api/v0/dht/put
and/api/v0/routing/put
and removes
--verbose
flag from all of them.I'm not sure how critical this is. It would be great to get some feedback on why it was the way it was.
Other Notes
ipfs routing get <name>
fetchs the signed IPNS key in protobuf: https://github.com/ipfs/go-ipns/blob/master/pb/ipns.proto. The output, in combination with the key, can be validated with the code below.